package com.tiantianfresh.admin.service.Impl;

import com.tiantianfresh.admin.service.RotationchartService;
import com.tiantianfresh.model.dao.RotationchartMapper;
import com.tiantianfresh.model.pojo.Rotationchart;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class RotationchartServiceImpl implements RotationchartService {
    @Resource
    private RotationchartMapper rotationchartMapper;
    @Override
    /**
     * 添加方法
     */
    public boolean addRotationchart(Rotationchart rotationchart) {
        rotationchart.setChartpath("assets/imgs/slider/"+rotationchart.getChartname()+".jpg");
        if (rotationchartMapper.addRotationchart(rotationchart)>0) return true;
        return false;
    }
  // 查询全部
    @Override
    public List<Rotationchart> selectAll() {
        return rotationchartMapper.selectAll();
    }

    @Override
    public int deleteRotationchartById(Map<String,Integer> map) {
        return rotationchartMapper.deleteRotationchartById(map);
    }

    @Override
    public boolean updateRotationchart(Rotationchart rotationchart) {
        if (rotationchartMapper.updateRotationchart(rotationchart)>0) return true;
        return false;
    }

    @Override
    public Rotationchart queryRotationchartById(int id) {
        return rotationchartMapper.queryRotationchartById(id);
    }

    @Override
    public boolean deltePermission(Integer id) {
        if (rotationchartMapper.deltePermission(id)>0) return true;
        return false;
    }
}
